import Vue from 'vue'
// import App from './views/Login.vue'
import App from './App.vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import 'font-awesome/css/font-awesome.min.css'
// import axios from 'axios'  未封装
import connector from './connector' //封装后的axios
import router from './router/index.js'
import echarts from 'echarts'

// Vue.prototype.axios=axios //挂载至原型 全局使用 未封装
Vue.prototype.connector = connector //挂载至原型 全局使用
Vue.prototype.$echarts = echarts

Vue.use(ElementUI)
Vue.config.productionTip = false
// 路由导航守卫
router.beforeEach((to, from, next) => {
  if (!localStorage.getItem('username')) {
    if (to.path !== '/login') {
      next('/login')
    } else next()
  } next()
})
new Vue({
  router,
  render: h => h(App),
}).$mount('#app')
